import getQuery from "./getQuery";
import http from "./http";
import $ from 'jquery'
import Mdjs from 'md-js'
// console.log(getQuery('id'))

$(function () {

  http({
    url: `https://gank.io/api/v2/post/${getQuery('id')}`
  }).then(res => {
    const { title, author, createdAt, markdown, views } = res.data

    $('.title').html(title)
    $('.author').html(author)
    $('.time').html(createdAt)
    $('.preview').html(views)

    let html = Mdjs.md2html(markdown);
    // console.log(html)
    $('.detail').html(html)
    // console.log(markdown)

  }).catch(e => {
    console.log(e)
  }).finally(() => {

  })


})

